package Web;

import Covid.enums.ContactHistory;
import Covid.enums.DiagnosisResult;
import Covid.enums.Symptom;
import Engine.CovidDiagnosisEngine;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

// DiagnosisController.java
@RestController
@RequestMapping("/api/diagnosis")
public class DiagnosisController {
    private final CovidDiagnosisEngine engine;

    public DiagnosisController(CovidDiagnosisEngine engine) {
        this.engine = engine;
    }

    @PostMapping
    public ResponseEntity<DiagnosisResponse> diagnose(@RequestBody DiagnosisRequest request) {
        DiagnosisResult result = engine.diagnose(
                request.getSymptoms(),
                request.getContactHistories(),
                request.getTemperature()
        );
        return ResponseEntity.ok(new DiagnosisResponse(result));
    }
}

